<template>
	<view>
		<view class="logo">LOGO</view>
		<view class="padding30">
			<view v-if="code==1">
				<view class="inputBox">
					<view class="iconfontstyle">
						<view>+86</view>
						<view class="fontSmall">中国大陆</view>
					</view>
					<input type="text" placeholder="请输入手机号" class="lnameInput">
				</view>
				<!-- 同意条款 -->
				<view class="agreeTK">
					<view class="rgou">
						<uni-icons type="checkmarkempty" color='#FFF'></uni-icons>
					</view>
					<view class="argeetk">
						已阅读并同意
						<text class="colorBlue">服务条款</text>和
						<text  class="colorBlue">隐私政策</text>
					</view>
				</view>
			</view>
			<!-- 输入验证码 -->
			<input v-else-if="code==2" type="text" value="" placeholder="请输入验证码" maxlength="6" class="inputBox lnameInput yzcodeStyle" />
			<!-- 请输入新密码 -->
			<!-- 输入验证码 -->
			<input v-if="newpwd==true" type="text" value="" placeholder="请输入新密码" maxlength="6" class="inputBox lnameInput yzcodeStyle" />
			<!-- 登录 -->
			<view class="logoBtn" v-if="code==1" @click="nextStep">下一步</view>
			<view class="logoBtn" v-else @click="register">{{btnFont}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				code:1,
				btnFont:'注册',
				static:null,
				newpwd:null
			}
		},
		methods: {
			nextStep:function(){
				this.code=2
			},
			register:function(){
				if(this.code==3&&this.newpwd==true){
					uni.showToast({
						title:'注册成功,请登录',
						duration:1500
					})
					setTimeout(function(){
						uni.reLaunch({
							url:'/pages/login/login'
						})
					},1600)
				}
				if(this.static==1){
					if(this.code==1){
						this.code=2
					}else{
						this.code=3
						this.newpwd=true	
					}
					
				}else{
					uni.showToast({
						title:'注册成功,请登录',
						duration:1500
					})
					setTimeout(function(){
						uni.reLaunch({
							url:'/pages/login/login'
						})
					},1600)
				}
			}
			
		},
		onLoad(option) {
			this.static=option.static
			if(option.static==1){
				this.btnFont='确定'
			}
		}
	}
</script>

<style>
	.logo {
		margin: 200rpx auto;
		text-align: center;
		font-size: 40rpx;
		width: 180rpx;
		height: 180rpx;
		line-height: 180rpx;
		border-radius: 100rpx;
		color: #fff;
		background-color: #007AFF;
	}

	.inputBox {
		position: relative;
		width: 80vw;
		margin: 30rpx auto;
	}

	.lnameInput {
		border-bottom: 1px solid #000;
		padding-left: 120rpx;
		width: 80vw;
		box-sizing: border-box;
		height: 90rpx;
	}

	.iconfontstyle {
		position: absolute;
		left: 0;
		bottom: 10rpx;
		text-align: center;
	}

	.logoBtn {
		width: 80vw;
		line-height: 80rpx;
		/* border: 1px solid #000000; */
		text-align: center;
		margin: 0 auto;
		border-radius: 10rpx;
		margin-top: 80rpx;
		background-color: #007AFF;
		color: #fff;
		font-weight: bold;
		font-size: 30rpx;
	}

	/* 注册单选 */
	.rgou {
		width: 30rpx;
		height: 30rpx;
		text-align: center;
		background-color: #007AFF;
		line-height: 30rpx;
		border-radius: 15rpx;
	}
	.agreeTK{
		display: flex;
		font-size: 25rpx;
		width: 80vw;
		margin: 0 auto;
	}
	.colorBlue{
		color: #007AFF;
	}
	.argeetk{
		line-height: 30rpx;
		margin-left: 10rpx;
		color: #666;
	}
	.yzcodeStyle{
		padding: 0;
	}
</style>
